using Entitas;

public class CreateCellSystem : IExecuteSystem
{
    LogicContext mContext;

    public CreateCellSystem(LogicContext context)
    {
        mContext = context;
    }

    public void Execute()
    {
        var entities = mContext.GetGroup(LogicMatcher.CreateCell).GetEntities();

        foreach (var e in entities)
        {
            if (e.createCell.CurFrame >= e.createCell.TargetFrame)
            {
                LogicApi.CreateCell(mContext, e.createCell.Hp, e.createCell.Color, e.createCell.Pos, e);
                e.RemoveCreateCell();
            }
            else
                e.createCell.CurFrame++;
        }
    }
}